/*
package com.devshephard.framework.config;


import com.zaxxer.hikari.util.UtilityElf;
import io.netty.util.concurrent.DefaultThreadFactory;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.core.io.Resource;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

*/
/**
 * 切莫用于生产环境（后果自负）,
 * <p>
 * Mybatis 映射文件热加载（发生变动后自动重新加载）.
 * </p>
 * <p>
 * 方便开发时使用，不用每次修改xml文件后都要去重启应用.
 * </p>
 *//*

public class MybatisMapperRefreshRunnable implements Runnable {
    private MybatisMapperRefresh refreshInstance;
    */
/**
     * 是否开启刷新mapper
     *//*

    private boolean enabled;
    */
/**
     * 延迟加载时间
     *//*

    private int delaySeconds = 10;
    */
/**
     * 刷新间隔时间
     *//*

    private int sleepSeconds = 20;

    public MybatisMapperRefreshRunnable(Resource[] mapperLocations, SqlSessionFactory sqlSessionFactory,
                                        int delaySeconds, int sleepSeconds, boolean enabled) {
        this.delaySeconds = delaySeconds;
        this.sleepSeconds = sleepSeconds;
        this.enabled = enabled;
        refreshInstance = MybatisMapperRefresh.getInstance(mapperLocations, sqlSessionFactory);
        this.run();
    }

    public MybatisMapperRefreshRunnable(Resource[] mapperLocations, SqlSessionFactory sqlSessionFactory,
                                        boolean enabled) {
        this.enabled = enabled;
        refreshInstance = MybatisMapperRefresh.getInstance(mapperLocations, sqlSessionFactory);
        this.run();
    }

    @Override
    public void run() {
        */
/*
         * 启动 XML 热加载
         *//*

        if (enabled) {
            // 创建线程池
            ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, 10, 100, TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(10), new DefaultThreadFactory("Mybatis 映射文件热加载"));
            threadPool.execute(() -> {
                refreshInstance.initFileSet();
                try {
                    Thread.sleep(delaySeconds * 1000);
                } catch (InterruptedException interruptedException) {
                    interruptedException.printStackTrace();
                }
                do {
                    refreshInstance.refreshChangeFile();
                    try {
                        Thread.sleep(sleepSeconds * 1000);
                    } catch (InterruptedException interruptedException) {
                        interruptedException.printStackTrace();
                    }
                } while (true);
            });
        }
    }
}*/
